<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<c:set var="base" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>设备管理</title>
  <link href="${base}/assets/css/public.css" rel="stylesheet">
  <script src="${base}/assets/js/jquery.min.js"></script>
  <link rel="stylesheet" type="text/css" href="${base}/assets/easyui/themes/gray/easyui.css" />
  <link rel="stylesheet" type="text/css" href="${base}/assets/easyui/themes/icon.css" />
  <script type="text/javascript" src="${base}/assets/easyui/jquery.easyui.min.js"></script>
  <script type="text/javascript" src="${base}/assets/easyui/locale/easyui-lang-zh_CN.js"></script>
</head>
<body>

<div class="top">
   <c:import url="../commons/top.jsp"/>
</div>
<div class="wrap">
  <div class="side">
   	<c:import url="../commons/sidebar.jsp"/>
  </div>
  <div class="cont">
    <div class="bread">
      <span>用户管理</span><span>&nbsp;&gt;&nbsp;</span><span>修改用户</span>
      <div class="excel-add">
      		<a class="add" style="float: right;margin-right: 30px;" href="javascript:void(0)" onclick="fahui()">返回</a>
      </div>
      <div class="clear"></div>
    </div>
<form method="post" action="${base}/back/usermod.do" id="donaForm">
<input type="hidden" name="uid" value="${user.uid}"/>
    <div class="form-group">
        <label>车间名称:</label>
        <div class="group-add">
            <input disabled name="workname" class="easyui-validatebox" data-options="required:true" placeholder="" value="${user.workname}"/>
        </div>
        <div class="clear"></div>
    </div>
    <div class="form-group">
        <label>用户姓名:</label>
        <div class="group-add">
            <input name="uname" class="easyui-validatebox" data-options="required:true" placeholder="" value="${user.uname}"/>
        </div>
        <div class="clear"></div>
    </div>
    <div class="form-group">
        <label>联系方式:</label>
        <div class="group-add">
            <input name="uphone" class="easyui-validatebox" data-options="required:true, validType:'maxLength[15]'" value="${user.uphone}" />
        </div>
        <div class="clear"></div>
    </div>
    <div class="form-group">
        <label>登录账号:</label>
        <div class="group-add">
            <input id="uacc" name="uacc" class="easyui-validatebox" data-options="required:true" placeholder="" value="${user.uacc}"/>
        </div>
        <div class="clear"></div>
    </div>
    <div class="form-group">
        <label>用户密码:</label>
        <div class="group-add">
            <input name="passw" class="easyui-validatebox" data-options="required:true" placeholder="" />
        </div>
        <div class="clear"></div>
    </div>
    <div class="form-group">
        <label>账号备注：</label>
        <div class="group-add">
            <textarea name="remark" class="easyui-validatebox" style="width:50%" data-options="required:true" rows="3" cols="93">${user.remark}</textarea>
        </div>
        <div class="clear"></div>
    </div>
    <div class="form-actions">
      <a onclick="submitDona()" class="btn" style="background-color:#337ab7; color:#fff" onclick="submitDona()">提交</a>
    </div>
</form>
  </div>
</div>
<div class="clear"></div>
<script type="text/JavaScript">
$("#uacc").change(function() { 

	var uacc = $.trim($("#uacc").val());
	   $.ajax({
        type: "POST",
        dataType: "json", // 数据格式:JSON
        url: '${base}/back/uacccheck.do?uacc='+uacc,
       // data: postData,
        success: function (data) {
     	   if(data.ok == 'ok'){ 
     	   }else{
     		   alert("登录账号已存在！！")
     		   return;
     	   }
        }
       
    });
});
   function submitDona(){
	   if(!$('#donaForm').form('validate')){
           return false;
       }
	  
	   var postData = $('#donaForm').serialize();
       $.ajax({
           type: "POST",
           url: '${base}/back/usermod.do',
           data: postData,
           success: function (data) {
        	 var mymessage=window.confirm('修改成功！是否返回');  
      		 if(mymessage==true){  
      		   	fahui();
      		 }else if(mymessage==false){  
      		   	return; 
      		 }
           }
       });
   }
   function fahui(){
  		var url ="${base}/back/userlist.do";
  		window.location.href = url;
  	}
</script>
</body>
</html>